#include "CCamera.h"


CCamera::CCamera(ISceneManager* smgr, ISceneNode* table) : distance(120.f)
{
	//distance = 120.f;

	node = smgr->addCameraSceneNode();

	if (node)
	{
		node->setParent(table);
		node->setTarget(vector3df(0.f, TABLE_HEIGHT-10, 0.f));
		
		rotateToDegree(table->getRotation().Y + 45);
	}
}


void CCamera::rotateToDegree(f32 degree)
{
	node->setPosition(node->getPosition() + vector3df(
		distance * sin(degree * DEGTORAD), TABLE_HEIGHT+50, distance * cos(degree * DEGTORAD)));
}


CCamera::~CCamera(void)
{
}
